package com.hangan.langchainspringstart.service;

import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.spring.AiService;
import dev.langchain4j.service.spring.AiServiceWiringMode;
import reactor.core.publisher.Flux;

/**
 * 带有会话记忆的流式对话
 *
 * @author hang an
 * @since 2025/7/30
 */
@AiService(
        wiringMode = AiServiceWiringMode.EXPLICIT, // 意味手动指定
        chatModel = "openAiChatModel", // 模型
        streamingChatModel = "openAiStreamingChatModel", // 流式模型
        chatMemoryProvider = "chatMemoryProvider" , // 会话记忆
        contentRetriever = "contentRetriever",  // RAG向量检索
        tools = "reservationTool"  // 工具
)
public interface MemoryStreamChat {
    @SystemMessage(fromResource = "system.txt")
    Flux<String> chat(@MemoryId String memoryId, @UserMessage String question);

}
